home *** CD-ROM | disk | FTP | other *** search
/ Programmers Heaven 2 / Programmers Heaven 2.iso / files / graphics / library / wgt51_r2.zip / WGT5 / H / WGT5.H < prev    next >
C/C++ Source or Header  |  1996-08-02  |  11KB  |  337 lines

  1. #ifndef _WGT5_
  2. #define _WGT5_
  3.  
  4. /* 
  5.    WordUp Graphics Toolkit V5.0 Header File
  6.    WATCOM C/C++ FLAT MODEL
  7.    
  8.    Copyright 1995 Egerter Software
  9. */
  10.  
  11. #include <stdio.h>
  12.  
  13. #ifdef __cplusplus
  14.  extern "C" {
  15. #endif
  16.  
  17. typedef unsigned char * block;
  18. typedef unsigned char * wgtfont;
  19. typedef unsigned short * wgtmap;
  20.  
  21. /* Text grid settings */
  22. #define TEXTGRID_OFF 0
  23. #define TEXTGRID_ON 1
  24.  
  25. /* Text transparency settings */
  26. #define TEXTFG 0
  27. #define TEXTBG 1
  28. #define TEXTFGBG 2
  29.  
  30. /* Image transfer operations */
  31. #define NORMAL 0
  32. #define XRAY 1
  33.  
  34. /* whollowpoly types */
  35. #define CLOSED_POLY 0
  36. #define OPEN_POLY 1
  37.  
  38. /* Flip block operations */
  39. #define VERTICAL 0
  40. #define HORIZONTAL 1
  41.  
  42. /* Shading operations */
  43. #define SHADE_NORMAL 0
  44. #define SHADE_XRAY 1
  45. #define SHADE_SHADOW 2
  46. #define SHADE_TRANSLUCENT 3
  47. #define SHADE_MONO 4
  48.  
  49. /* Triangle Rendering Methods */
  50. #define WIREFRAME             0
  51. #define SOLID                 1
  52. #define GOURAUD               2
  53. #define TEXTURE               3
  54. #define FLAT_SHADE_TEXTURE    4
  55. #define GOURAUD_SHADE_TEXTURE 5
  56. #define TRANSLUCENT_TEXTURE   6
  57. #define TRANSLUCENT_GOURAUD   7
  58.  
  59. /* Convert from ticks/sec */
  60. #define TICKS(hz) ((int)(1193182L/(hz)))
  61.  
  62. extern struct {
  63.   short xres;
  64.   short yres;
  65.   short videomode;
  66.   int   videobanksize;
  67.   short (*bankswitch)(short);
  68.   short screenwidth;
  69.   short screenheight;
  70. } WGT_SYS;
  71.  
  72.  
  73. /* A single palette register definition */
  74. typedef struct 
  75. {
  76.   unsigned char r,g,b;
  77. } color;
  78.  
  79.  
  80. /* Triangle point definition */
  81. typedef struct
  82. {
  83.   short x,y;           /* Coordinate on the screen */
  84.   long sx,sy;          /* Coordinate on the texture */
  85.   short col;
  86. } tpoint;
  87.  
  88.  
  89. /* Polygon point definition */
  90. typedef struct
  91. {
  92.   short x,y;   /* Coordinate on the screen */
  93.   short sx,sy; /* Coordinate on the texture if texture is used,
  94.           otherwise sx = color point */
  95.            /* sx is used for Gouraud shading as well (color of the point) */
  96. } tpolypoint;
  97.  
  98. /* Scan converted polygon routines */
  99. typedef struct 
  100. {
  101.   short **pointbuffer;       /* Holds a buffer of x coordinates for each
  102.                 row of the polygon. */
  103.   unsigned short *numpoints; /* Holds the size of the point buffer in
  104.                 bytes. */
  105. } wscanpoly;
  106.  
  107.  
  108.  
  109. /* WGTLIB variables */
  110. extern fpos_t lfpos;
  111. extern FILE *libf;
  112. extern short lresult;
  113. extern int   lsize;
  114. extern char  password[16];
  115. extern char  *wgtlibrary;
  116.  
  117. /* Keyboard Interrupt */
  118. extern short kbdon[128];
  119. extern short keypressed;
  120.  
  121. /* Mouse variables */
  122. typedef struct {
  123.   short but;
  124.   short mx;
  125.   short my;
  126. } callback_data;
  127. extern callback_data mouse;
  128.  
  129. /* Clipping boundaries */
  130. extern short bx,by,tx,ty;
  131.  
  132. /* Current drawing color */
  133. extern unsigned char currentcolor;
  134.  
  135. /* Software cursor flashing speed */
  136. extern short curspeed;
  137.  
  138. /* Software cursor coordinates */
  139. extern short xc,yc;
  140.  
  141. /* Pointer to the active drawing page */
  142. extern block abuf;
  143.  
  144. typedef void (*wtimerproc)(void);
  145.  
  146.  
  147. /* Function Prototypes */
  148. short  checkpassword (char *temp);
  149. void   findfile (char *filename);
  150. unsigned int getmemfree (void);
  151. void   installkbd (void);
  152. void * lib2buf (char *filename);
  153. short  lock_region (void *address, unsigned length);
  154. void   mdeinit (void);
  155. short  minit (void);
  156. void   moff (void);
  157. void   mon (void);
  158. void   mouseshape (short x_hotspot, short y_hotspot,
  159.                    unsigned short *mousebitmap);
  160. void   msetbounds (short x, short y, short x2, short y2);
  161. void   msetspeed (short x_speed, short y_speed);
  162. void   msetthreshhold (short speed);
  163. void   msetxy (short x, short y);
  164. void   noclick (void);
  165. void   readheader (void);
  166. void   setlib (char *libraryname);
  167. void   setpassword (char *password);
  168. void   uninstallkbd (void);
  169. void   vga256 (void);
  170. char   vgadetected (void);
  171. block  wallocblock (short width, short height);
  172. void   wbar (short x1, short y1, short x2, short y2);
  173. void   wbezier (tpolypoint *rawpts, short numraw, tpolypoint *curvepts,
  174.         short numcurve);
  175. void   wbutt (short x1, short y1, short x2, short y2);
  176. void   wcircle (short x_center, short y_center, short radius);
  177. void   wclip (short x1, short y1, short x2, short y2);
  178. void   wcls (unsigned char col);
  179. void   wcolrotate (unsigned char start, unsigned char finish, short dir,
  180.            color *pal);
  181. void   wcopyscreen (short x1, short y1, short x2, short y2, block source,
  182.                     short destx, short desty, block destination);
  183. void   wdeinitpoly (void);
  184. void   wdeinit_triangle_renderer (void);
  185. void   wdissolve (block sourceimage, short *pattern, short speed);
  186. void   wdonetimer (void);
  187. void   wdraw_scanpoly (short x, short y, wscanpoly *scanpoly,
  188.             void (*customline)(short x1, short x2, short y));
  189. void   wellipse (short x_center, short y_center, short x_radius,
  190.                  short y_radius);
  191. void   wfade_between (unsigned char start, unsigned char finish, short speed,
  192.               color *pal1, color *pal2);
  193. void   wfade_between_once (unsigned char start, unsigned char finish,
  194.               color *pal1, color *pal2);
  195. void   wfade_in (unsigned char start, unsigned char finish, short speed,
  196.          color *pal);
  197. void   wfade_in_once (unsigned char start, unsigned char finish, 
  198.               color *pal, color *temppal);
  199. void   wfade_out (unsigned char start, unsigned char finish, short speed,
  200.           color *pal);
  201. void   wfade_out_once (unsigned char start, unsigned char finish,
  202.                color *pal);
  203. void   wfastputpixel (short x, short y);
  204. void   wfill_circle (short x, short y, short radius);
  205. void   wfill_ellipse (short x_center, short y_center, short x_radius,
  206.                       short y_radius);
  207. void   wflashcursor (void);
  208. void   wfline (short x1, short y1, short x2, short y2);
  209. void   wflipblock (block image, short direction);
  210. void   wfree_scanpoly (wscanpoly *scanpoly);
  211. void   wfreeblock (block image);
  212. void   wfreefont (wgtfont font);
  213. void   wfreesprites (block *image_array, short start, short end);
  214. short  wget_capslock (void);
  215. unsigned char wget_imagebit (block image);
  216. unsigned char wget_imagebyte (block image);
  217. short  wget_lalt (void);
  218. short  wget_lctrl (void);
  219. short  wget_lshift (void);
  220. short  wget_numlock (void);
  221. short  wget_ralt (void);
  222. short  wget_rctrl (void);
  223. short  wget_rshift (void);
  224. short  wget_scrlock (void);
  225. short  wgetblockheight (block image);
  226. short  wgetblockwidth (block image);
  227. short  wgetmode (void);
  228. unsigned char wgetpixel (short x, short y);
  229. short  wgettextheight (char *string, wgtfont font);
  230. short  wgettextwidth (char *string, wgtfont font);
  231. void   wgouraudpoly (tpolypoint *vertexlist, short numvertex, short x, short y);
  232. void   wgtprintf (short x, short y, wgtfont font, char *fmt, ... );
  233. void   whline (short x1, short x2, short y);
  234. void   whollowpoly (tpolypoint *vertexlist, short numvertex, short x, short y,
  235.             short closemode);
  236. void   winitpoly (short maxrows);
  237. void   winittimer (void);
  238. void   winit_triangle_renderer (short maxrows);
  239. void   wline (short x1, short y1, short x2, short y2);
  240. block  wloadblock (char *filename);
  241. block  wloadbmp (char *filename, color *pal);
  242. block  wloadcel (char *filename, color *pal);
  243. wgtfont wloadfont (char *filename);
  244. block  wloadiff (char *filename, color *pal);
  245. block  wloadpak (char *filename);
  246. void   wloadpalette (char *filename, color *pal);
  247. block  wloadpcx (char *filename, color *pal);
  248. short  wloadsprites (color *pal, char *filename, block *image_array,
  249.                      short start, short end);
  250. block  wnewblock (short x1, short y1, short x2, short y2);
  251. void   wnormscreen (void);
  252. short  woutchar (short asc, short xc, short yc, wgtfont pr);
  253. void   wouttextxy (short x, short y, wgtfont font, char *string);
  254. void   wpan (unsigned short pan_offset);
  255. void   wputblock (short x, short y, block image, short method);
  256. void   wputblock_shade (short x, short y, block image, block shadetable,
  257.             int mode);
  258. void   wputpixel (short x, short y);
  259. void   wreadpalette (unsigned char start, unsigned char finish, color *pal);
  260. void   wrectangle (short x1, short y1, short x2, short y2);
  261. void   wregionfill (short x, short y);
  262. void   wremap (color *pal1, block image, color *pal2);
  263. void   wresize (int x1, int y1, int x2, int y2, block image,
  264.         short mode);
  265. void   wresize_column (int x, int y, int y2, block image,
  266.                short column, short mode);
  267. void   wresize_shade (short x1, short y1, short x2, short y2,
  268.               block image, unsigned char *shadetable,
  269.               short mode);
  270. void   wretrace (void);
  271. short  wsaveblock (char *filename, block image);
  272. short  wsavebmp (char *filename, block image, color *pal);
  273. short  wsavecel (char *filename, block image, color *pal);
  274. short  wsavepak (char *filename, block image);
  275. void   wsavepalette (char *filename, color *pal);
  276. short  wsavepcx (char *filename, block image, color *pal);
  277. short  wsavesprites (color *pal, char *filename, block *image_array,
  278.                      short start, short end);
  279. void   wscan_convertpoly (tpolypoint *vertexlist, short numvertex,
  280.             wscanpoly *scanpoly);
  281. void   wset_capslock (short state);
  282. void   wset_imagebyte (block image, unsigned char status);
  283. void   wset_numlock (short state);
  284. void   wset_scrlock (short state);
  285. void   wsetcolor (unsigned char col);
  286. void   wsetcursor (short start, short end);
  287. void   wsetmode (short mode);
  288. void   wsetpalette (unsigned char start, unsigned char finish, color *pal);
  289. void   wsetrgb (unsigned char num, unsigned char red, unsigned char green, 
  290.         unsigned char blue, color *pal);
  291. void   wsetscreen (block image);
  292. void   wsettimerspeed (int speed);
  293. void   wskew (short x, short y, block image, short degrees);
  294. void   wsline (short x1, short y1, short x2, short y2, short *y_array);
  295. void   wsolidpoly(tpolypoint *vertexlist, short numvertex, short x, short y,
  296.             void (*customline)(short x1, short x2, short y));
  297. void   wstarttimer (wtimerproc timer, int speed);
  298. void   wstoptimer (void);
  299. void   wstring (short x, short y, char *string, char *legal, short maxlength);
  300. void   wstyleline (short x, short y, short x2, short y2, unsigned short style);
  301. void   wtextbackground (unsigned char col);
  302. void   wtextcolor (unsigned char col);
  303. void   wtextgrid (short state);
  304. void   wtexttransparent (short mode);
  305. void   wtexturedpoly (tpolypoint *vertexlist, short numvertex, short x,
  306.                       short y, block image, short mode);
  307. void   wtriangle_flat_shaded_texture (tpoint *ttri, block texture, 
  308.                       short shade, block shadetable);
  309. void   wtriangle_gouraud (tpoint *gtri);
  310. void   wtriangle_gouraud_shaded_texture (tpoint *ttri, block texture,
  311.                      block shadetable);
  312. void   wtriangle_solid (tpoint *ftri);
  313. void   wtriangle_texture (tpoint *ttri, block texture);
  314. void   wtriangle_translucent_gouraud (tpoint *gtri, block shadetable);
  315. void   wtriangle_translucent_texture (tpoint *ttri, block texture,
  316.                   block shadetable);
  317. void   wupdate_imagebytes (block *image_array, short start, short end);
  318. void   wvertres (short x1, short y1, short y2, block image);
  319. void   wwarp (short x1, short x2, short *top, short *bot, block image,
  320.               int mode);
  321. void   wwipe (short x1, short y1, short x2, short y2, block image);
  322. void   wxorbox (short x, short y, short x2, short y2, unsigned char col);
  323.  
  324. /* File Selector */
  325. char *wfilesel (char *mask, char *title, short x, short y, block background);
  326. extern wgtfont filefont;
  327.  
  328. #ifdef __cplusplus
  329. }
  330. #endif
  331.  
  332. #endif
  333.  
  334.  
  335.  
  336.  
  337.